var bgm = new Audio('./audio/bgm.mp3')
bgm.loop = true
var boom = new Audio('./audio/boom.mp3')
var bulletSound = new Audio('./audio/bullet.mp3')

//我们需要封装一个新的对象， 来实现更加复杂的声音播放效果
//构造函数
function Boom(boomList) {
    //clone 克隆 / 复制  node节点
    this.audio = boom.cloneNode(true)

    this.play = function () {
        this.audio.play()
    }
    //用that把 this 存储起来， 在下面的事件处理函数中使用
    var that = this

    this.audio.onended = function () {
        boomList.recycle(that)
    }
}